package rexsee.sensor;

import android.hardware.SensorManager;

public class SensorRate {

	public static final String RATE_NORMAL = "normal";
	public static final String RATE_FASTEST = "fastest";
	public static final String RATE_GAME = "game";
	public static final String RATE_UI = "ui";

	public static int getInt(String rate) {
		rate = rate.toLowerCase();
		if (rate.equals(RATE_FASTEST)) return SensorManager.SENSOR_DELAY_FASTEST;
		else if (rate.equals(RATE_GAME)) return SensorManager.SENSOR_DELAY_GAME;
		else if (rate.equals(RATE_UI)) return SensorManager.SENSOR_DELAY_UI;
		else return SensorManager.SENSOR_DELAY_NORMAL;
	}
	public static String getString(int rate) {
		switch (rate) {
			case SensorManager.SENSOR_DELAY_FASTEST :
				return RATE_FASTEST;
			case SensorManager.SENSOR_DELAY_GAME :
				return RATE_GAME;
			case SensorManager.SENSOR_DELAY_UI :
				return RATE_UI;
			default :
				return RATE_NORMAL;
		}
	}

}
